<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta charset="utf-8">
    <meta http-equiv="Content-Type" content="text/html;charset=utf-8" />
    <meta name="renderer" content="webkit">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1">
    <meta name="keywords" content="" />
    <meta name="description" content="overview &amp; stats"/>
    <link href="/public/css/all.min.css" rel="stylesheet"  />
    <link href="/public/css/toastr.min.css" rel="stylesheet"  />
    <link href="/public/css/ionicons.min.css" rel="stylesheet"  />
    <link href="/public/css/font.css" rel="stylesheet"  />
    <link rel="stylesheet" type="text/css" href="/public/css/admin.css" >
    <link rel="shortcut icon" href="/public/images/favicon.ico">
    <link href="/public/css/adminlte.min.css" rel="stylesheet"  />
    <script type="text/javascript" src="/public/js/jquery.min.js"></script>
    <script type="text/javascript" src="/public/js/bootstrap.bundle.min.js"></script>
    <script type="text/javascript" src="/public/js/adminlte.min.js"></script>
    <script type="text/javascript" src="/public/js/demo.js"></script>
    <script type="text/javascript" src="/public/js/toastr.min.js"></script>
    <script type="text/javascript" src="/public/js/common.js"></script>
</head>
<body class="hold-transition login-page">
<div class="login-box">
    <div class="login-logo">
        <b>后台管理</b>系统
    </div>
    <!-- /.login-logo -->
    <div class="card">
        <div class="card-body login-card-body">
            <p class="login-box-msg">请输入您的信息</p>
            <form action="/admin" method="post">
                <div class="input-group mb-3">
                    <input type="text" name="username" class="form-control" placeholder="账号">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-user"></span>
                        </div>
                    </div>
                </div>
                <div class="input-group mb-3">
                    <input type="password" name="password" class="form-control" placeholder="密码">
                    <div class="input-group-append">
                        <div class="input-group-text">
                            <span class="fas fa-lock"></span>
                        </div>
                    </div>
                </div>
                <div class="input-group  mb-3 row">
                    <div >
                        <input type="text" id="validateCode" placeholder="请输入右侧答案" name="validateCode" autocomplete="off" maxlength="5"
                               class="form-control" style="line-height:44px;width: 100%"
                               aria-required="true">

                    </div>
                    <div class="form-right" id="code" onclick="changeCaptcha()">
                    </div>
                </div>
                <div class="social-auth-links text-center mb-3">
                    <button id="login" class="btn btn-block btn-primary" type="submit">登录</button>
                    <p class="red">{{msg}}</p>
                </div>
            </form>
        </div>
        <!-- /.login-card-body -->
    </div>
</div>

<script type="text/javascript">
    //是否已经提交过了，防止重复提交
    var issubmit = false;
    function loginSys() {
        if(!issubmit){
            issubmit = true;
            $("#login").submit();
        }
    }

    $(function(){
        /**
        * 监听回车事件
        */
        $("body").unbind("keydown").bind("keydown",function(e){
            // 兼容FF和IE和Opera
            var theEvent = e || window.event;
            var code = theEvent.keyCode || theEvent.which || theEvent.charCode;
            if (code == 13) {
            //回车执行查询
                loginSys();
            }
        });
        changeCaptcha();
    })

    function changeCaptcha() {
      $.get('/captcha', function (ret) {
        // $("#code").attr('src', ret)
        $("#code").html(ret)
      })
    };
</script>


</body>
</html>
